<html>
  <head>
    <title>Coverage Report</title>
    <link type="text/css" rel="stylesheet"
          href="yui/treeview/folder-tree.css"> 
    <link type="text/css" rel="stylesheet"
          href="yui/treeview/screen.css"> 
    <script src="yui/yahoo/yahoo-min.js" ></script>
    <script src="yui/event/event-min.js" ></script> 
    <script src="yui/treeview/treeview-min.js" ></script>
    <script src="yui/connection/connection-min.js" ></script>
    <script type="text/javascript">
      var dirList;
      function addDirs(dirs) {
        dirList = dirs.sort();
      }

      function loadSrcFolder(node, fnLoadComplete) {
        var fileName = "data/" + encodeURIComponent(encodeURIComponent(node.label)) + ".json";
	var callback =
	{
	  success: function(o) {
            // YUI has no json decoder? lame.
            var files = eval(o.responseText);
            for (var i=0; i < files.length; ++i) {
              var w = files[i];
              var n = new YAHOO.widget.HTMLNode(w, node, false);
            }
	    fnLoadComplete();
          },
	  failure: function(o) {
	    if (o.status == 0) {
              callback.success(o);
            } else {
              alert("error on load: " + o.status);
              fnLoadComplete();
            }
	  },
	  timeout: 5000,
	}
        YAHOO.util.Connect.asyncRequest('GET', fileName, callback);
      }
      var tree;
      function treeInit() {
	tree = new YAHOO.widget.TreeView("dirTree");
        var root = tree.getRoot();
	for (var i=0; i < dirList.length; ++i) {
          var w = dirList[i];
          var node = new YAHOO.widget.TextNode(w, root, false);
          node.setDynamicLoad(loadSrcFolder);
        }
	tree.draw();
      }
    </script>
    <script src="data/dirlist.json"></script>
  </head>
  <body onload="treeInit()">
    <div id="dirTree">
     
    </div>
  </body>
</html>